package com.lucett.aixingqing.view.contorller;

import java.util.Arrays;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.lucett.aixingqing.base.bean.HotelInfo;
import com.lucett.aixingqing.view.dao.HotelMapper;

@Controller
public class ViewContorller {
	
	@ResponseBody
	@RequestMapping(method = RequestMethod.GET, value = "/api/user/order/orderDetail")
	public String test(@RequestParam("site")String site, HttpServletRequest request, HttpServletResponse response, Model model){
		ClassPathXmlApplicationContext appContext = new ClassPathXmlApplicationContext("spring/application.xml");
		BeanFactory factory = (BeanFactory) appContext;
		HotelMapper hotelMapper = factory.getBean(HotelMapper.class);
		List<HotelInfo> hotelInfo = hotelMapper.queryHotelInfo();
		return Arrays.asList(hotelInfo).toString();
	}
	
	
}
